var conexion_petition;
function loadpage(url) 
{
  if(url=='')
  {
        return;
  }
  
  conexion_petition=postRequest();
  conexion_petition.onreadystatechange = procesarEventos;
  //conexion_petition.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
  conexion_petition.open("GET", url, true);
  conexion_petition.send(null);
}

function procesarEventos()
{
	
  if(conexion_petition.readyState == 4)
  {
	  realized(conexion_petition.responseText);
  } 
}   
        function realized(str){
            if(str=="yes"){
        	alert('Peticion Realizada ');
        	init_users();
        	}else{
				alert('Se ha presentado algun problema. Intentar mas tarde');
            }
        }
       
        function pfriends(formname){
        	resp=confirm("Enviar Peticion") 
    		if(resp) 
    		{  
    			    var id = document.forms[formname].elements['a'].value;
    		        var user_id = document.forms[formname].elements['user_id'].value;
    		        var url = "follow_friend.php?id="+id+"&user_id="+user_id ;
    		        loadpage(url);
    		}
    		else
    			return false;	       
        }